from paddleocr import PaddleOCR, draw_ocr

class OCREngine():

    def __init__(self, img_path):
        self.img_path = img_path 
        self.ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memory


    def run(self, file_name):
        result = self.ocr.ocr("{}/{}".format(self.img_path, file_name), cls=True)
        for idx in range(len(result)):
            res = result[idx]
            txts = [line[1][0] for line in res]
            print(txts[2], txts[3], txts[4])
            return txts[2], txts[3], txts[4]
